package com.example.shiro.bean;

import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * Copyright(C), 2020-2021, AmbroseCdMeng
 * FileName:    SysPermission
 * Author:      AmbroseCdMeng
 * Date:        2021/2/24 16:48
 * Description: 权限实体。用于存放权限数据
 * History:
 * <author>     <time>      <version>       <desc>
 * 作者姓名     修改时间        版本号           描述
 */
@Entity
@Data
public class SysPermission implements Serializable {
    @Id
    @GeneratedValue
    private Integer id;
    private String name; // 权限名称
    @Column(columnDefinition = "enum('menu', 'button')")
    private String resourceType;    // 资源类型
    private String url; // 资源路径
    private String permission;  // 权限字符串

    /**
     * 父编号
     */
    private Long parentId;
    /**
     * 父编号列表
     */
    private String parentIds;

    private Boolean available = Boolean.FALSE;
    @ManyToMany
    @JoinTable(name="SysRolePermission", joinColumns = {@JoinColumn(name = "permissionId")}, inverseJoinColumns = {@JoinColumn(name = "roleId")})
    private List<SysRole> roles;
}
